package After826.Thread;

import java.util.Scanner;

public class test1 extends Thread{
    @Override
    public void run() {
        Scanner input = new Scanner(System.in);
        System.out.print("请输入倒计时秒数:");
        int time = input.nextInt();
        for (int i = time; i>=0; i--) {
            try{
                System.out.println(i);
                sleep(1000);
            }catch (InterruptedException e){
                System.out.println("倒计时结束");
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
    public void go(){
        Thread thread = new Thread(this);
        thread.start();
    }
    public static void main(String[] args) {
     new test1().go();
    }
}
